package zonghe.exer06;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int n = sc.nextInt();
        if (n == 1) {
            System.out.println(1);
            return;
        }
        // 1. 状态表示：dp[i][j]表示n个人i次传递到j的个数
        int[][] dp = new int[m + 1][n + 1];
        // 2. 状态初始化
        dp[0][1] = 1;
        // 3. 状态转移
        for (int i = 1; i <= m; i++) {
            for (int j = 1; j <= n; j++) {
                if (j == 1) {
                    dp[i][j] = dp[i - 1][n] + dp[i - 1][2];
                } else if (j == n) {
                    dp[i][j] = dp[i - 1][1] + dp[i - 1][n - 1];
                } else {
                    dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j + 1];
                }
            }
        }
        // 4. 返回值
        System.out.println(dp[m - 1][1]);
    }
}
